<?php /*a:4:{s:62:"/home/pirate/wx_manager/app/open_card/view/admin/card_add.html";i:1606464318;s:35:"../app/common/admin/lib/header.html";i:1622026634;s:36:"../app/common/admin/lib/sidebar.html";i:1606282475;s:35:"../app/common/admin/lib/footer.html";i:1620273611;}*/ ?>
<?php
use think\facade\Request;
use app\common\model\User;
?>
<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <title><?php if($title): ?><?php echo htmlentities($title); ?>-<?php endif; ?>微信后台管理</title>
  <base href="<?php echo htmlentities(SITE_URL); ?>/"></base>
  <script type="text/javascript">
    var siteUrl = "<?php echo htmlentities(SITE_URL); ?>";
    var uploadUrl = "<?php echo htmlentities(UPLOAD_URL); ?>";
    var isAdmin = 1;
  </script>
  
  <link rel="stylesheet" type="text/css" href="./static/css/base.css" />
  <link rel="stylesheet" type="text/css" href="./static/css/admin/admin.css" />
  <link rel="stylesheet" href="/static/lib/layui-v2.5.4/css/layui.css" media="all">

  <?php if(in_array($module, explode(',', ',autoreply,appmsg,appmenu,appmenu_stat,key_stat,message,user'))): ?>
  <link rel="stylesheet" type="text/css" href="./static/css/admin/weixin.css" />
  <?php endif; ?>

  <script type="text/javascript" src="./static/js/jquery-1.7.1.min.js"></script>
  <script type="text/javascript" src="./static/js/jqueryui/1.8.11/jquery-ui.js"></script>
  <script type="text/javascript" src="./static/js/common.js"></script>
  <script type="text/javascript" src="./static/js/admin/admin.js"></script>
  <script type="text/javascript" src="./static/js/qDialog.js"></script>
  <script type="text/javascript" src="./static/js/zclip/jquery.zclip.min.js"></script>
  <script type="text/javascript" src="./static/js/zclip/ZeroClipboard.js"></script>
  <link rel="shortcut icon" href="./favicon.ico">
  <script src="/static/lib/layui-v2.5.4/layui.js?v=1.0.4" charset="utf-8"></script>
  <script src="/static/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
  <link rel="stylesheet" href="/static//css/admin/weiboface.css" type="text/css" />
  <script type="text/javascript" src="/static//js/weiboface.js"></script>
  <!--[if IE 6]>
  <script src="./static/js/DD_belatedPNG_0.0.8a-min.js"></script>
  <script>
    DD_belatedPNG.fix('.logo a,.n-icon');
  </script>
  <![endif]-->
  <script>
  $(function(){
    // 页面高度
    var windowHeight = $(window).height();
    var domHeight = $(document).height();
    if (domHeight > windowHeight) {
      windowHeight = domHeight;
    }
    if ($(".inner-center").height() < windowHeight - 66) {
      $(".inner-center").css('min-height', windowHeight - 66);
      //$('body').css('overflow', 'hidden');
    }
    
    // 用户设置浮层
    $(".js_userSetBtn").click(function(e){
     e.preventDefault();
     e.stopPropagation();
     
     $(".js_cardSetBox").addClass('hidden');
     if ($(".js_userSetBox").hasClass('hidden')) {
       $(".js_userSetBox").removeClass('hidden');
     } else {
       $(".js_userSetBox").addClass('hidden');
     }
    });

      // 公众号下拉浮层
      $(".js_cardSetBtn").click(function(e){
          e.preventDefault();
          e.stopPropagation();

          $(".js_userSetBox").addClass('hidden');
          if ($(".js_cardSetBox").hasClass('hidden')) {
              $(".js_cardSetBox").removeClass('hidden');
          } else {
              $(".js_cardSetBox").addClass('hidden');
          }
      });

      // 表情初始化
      weiboFaceInit({
          //emotionUrl: "javascript:;",
          data: <?php echo config('emotion.weixin_emotions'); ?>
      });
  });
  </script>
</head>
<body>

<div id="wrap">
  <div class="header">
    <div class="htop clearfix">
      
      <h1 class="logo left" style="width:300px;"><a href="<?php echo url('admin'); ?>">微信后台管理 [<?php echo htmlentities($open_card_info['title']); ?>] </h1>
      <?php if($user_id > 0): ?>
        
        <div class="infotop">
          <a href="javascript:void(0);" class="userpic"></a>
          <span class="username-right js_userSetBtn">
            <a href="javascript:;" class="username"><?php echo User::display_name($user_id); ?></a>
            <span class="arrowtop">
              <i></i>
            </span>
          </span>
          <div class="poptop poptop-user js_userSetBox hidden" style="background:white;">
            <em>◆</em>
            <ul>
              
              <li><a href="<?php echo url('home'); ?>">回前台</a></li>
              <li><a href="<?php echo url('/admin/logout/index'); ?>">退出</a></li>
            </ul>
          </div>
        </div>
      <?php else: ?>
        <div class="htop-login right">
          <a href="<?php echo url('admin'); ?>">登录</a>
          <a href="<?php echo url('user/register'); ?>">注册</a>
        </div>
      <?php endif; ?>
    </div>
  </div>
  <div class="container clearfix">
    <div class="sidebar left">
  <ul class="sidenav">
  <!-- {an_dump($sidebar_menu_list)} -->
    <?php foreach($sidebar_menu_list as $k=>$v): ?>
    <li class="js_topMenu">
      <a href="javascript:;"><?php echo htmlentities($v['title']); ?><em></em></a>
      <?php if($v['children']): ?>
      <ul class="sidenav2" style="display:none;">
        <?php foreach($v['children'] as $k1=>$v1): ?>
        <li class="<?php echo htmlentities($v1['curr']); ?>">
          <a href="<?php echo htmlentities($v1['url']); ?>" data-qian="vmodule::<?php echo htmlentities($v1['module']); ?> vcontroller::<?php echo htmlentities($v1['controller']); ?> vaction::<?php echo htmlentities($v1['action']); ?> ___ module::<?php echo htmlentities($module); ?> controller::<?php echo htmlentities($controller); ?> action::<?php echo htmlentities($action); ?> __ vextra::<?php echo htmlentities($v1['extra_res']); ?> extra::<?php echo htmlentities($extra_res); ?> vcurr::<?php echo htmlentities($v1['curr']); ?>"><?php echo htmlentities($v1['title']); ?>&nbsp;&nbsp;<i style="display:none;" style="color:red">(0)</i></a>
        </li>
        <?php endforeach; ?>
      </ul>
      <?php endif; ?>
    </li>
    <?php endforeach; ?>
  </ul>
</div>
<script>
$(function(){
  $('.js_topMenu').click(function(e){
    
    var s=e.target || e.srcElement;
    if ($(s).parents(".sidenav2").size()>0) {
      return;
    }

    $(this).siblings().removeClass('curr')
    $(this).siblings().find('ul:visible').slideUp();
    if (!$(this).find('ul:visible').length) {
      $(this).find('ul').slideDown();
      $(this).addClass('curr');
    } else {
      $(this).find('ul').slideUp();
      $(this).removeClass('curr');
    }
  });
  
  $(".sidenav2 li").each(function(i, n){
    if ($(this).hasClass('curr')) {
      $(this).closest('ul').show();
      $(this).closest('.js_topMenu').addClass('curr');
    };
  });
});
</script>
    <div class="center">
      <div class="inner-center">
<script type="text/javascript" src="./static/js/fancybox/jquery.fancybox.js"></script>
<script type="text/javascript" src="./static/js/fancybox/jquery.fancybox.pack.js"></script>
<script type="text/javascript" src="./static/js/fancybox/jquery.fancybox-buttons.js"></script>
<link rel="stylesheet" type="text/css" href="./static/js/fancybox/jquery.fancybox-buttons.css" />
<link rel="stylesheet" type="text/css" href="./static/js/fancybox/jquery.fancybox.css" />
<div class="page-header border-bottom clearfix">
  <h2 class="left">公众号管理<span><?php if($info): ?>编辑<?php else: ?>添加<?php endif; ?>公众号</span></h2>
  <a href="{AnUrl('open_card/admin')}" class="btn btn-default btn-sm right">&lt;&nbsp;返回公众号列表</a>
</div>
<!--start:公众号新增-->
<div class="add-form">
  <form class="js_creatForm" action="<?php echo url('/open_card/admin/save'); ?>" method="post" enctype="multipart/form-data">
    <input type="hidden" name="id" value="<?php echo htmlentities($info['id']); ?>">
    <table class="table" cellpadding="0" cellspacing="0">
      <tr>
        <th><label for="" class="add-f-label">公众号名称：</label></th>
        <td>
          <input name="title" style="width:280px;" value="<?php echo htmlentities($info['title']); ?>" type="text" class="add-f-ipt1 js_title">
          <div class="tips"><span style="line-height: 34px;color: #f00;margin-right: 10px;">*</span>公众号名称用于管理时使用</div>
        </td>
      </tr>
      <tr>
        <th><label for="" class="add-f-label">微信号：</label></th>
        <td>
          <input name="wechat_id" style="width:280px;" value="<?php echo htmlentities($info['wechat_id']); ?>" type="text" class="add-f-ipt1 js_wechatId">
          <div class="tips"><span style="line-height: 34px;color: #f00;margin-right: 10px;">*</span>微信号用于详情页展示，<a data-fancybox-type="image" rel="fancybox-button-wechat" href="<?php echo htmlentities(SITE_URL); ?>/static/images/admin/wechat_id.png" class="fancybox-button-wechat">如何获取</a></div>
        </td>
      </tr>
      <!--/*<tr>-->
        <!--<th><label for="" class="add-f-label">公众号原始ID：</label></th>-->
        <!--<td>-->
          <!--<input name="card" style="width:280px;" value="{$info.card" type="text" class="add-f-ipt1 js_card">-->
          <!--<div class="tips"><span style="line-height: 34px;color: #f00;margin-right: 10px;">*</span>公众号原始ID用于公众号认证，<a data-fancybox-type="image" rel="fancybox-button-card" href="<?php echo htmlentities(SITE_URL); ?>/images/controller/card_notice.png" class="fancybox-button-card">如何获取</a></div>-->
        <!--</td>-->
      <!--</tr>*/}-->
      <tr>
        <th valign="top"><label for="" class="add-f-label">公众号封面：</label></th>
        <td class="perUpOuter">
          <div class="clearfix">
            <div class="btn-upload left">
              <a href="javascript:void(0);"><i class="icon-upload"></i>上传封面</a>
              <input class="js_cover js_upFile"  type="file" name="cover">
            </div>
            <span class="tips left">&nbsp;&nbsp;&nbsp;<span style="line-height: 34px;color: #f00;margin-right: 10px;">*</span>封面图比例200*200</span>
          </div>
          <div class="js_upFileBox" <?php if(!$info['cover']): ?>style="display:none;"<?php endif; ?>>
              <?php if($info['cover']): ?><img src="<?php echo _image($info['cover'], 'small'); ?>"><?php endif; ?>
          </div>
        </td>
      </tr>
      <tr>
        <th><label for="" class="add-f-label">二级域名：</label></th>
        <td style="color:#898989;">
          http://&nbsp;<input <?php if($info): ?>readonly<?php endif; ?> name="domain" style="width:100px;" value="<?php echo htmlentities($info['domain']); ?>" type="text" class="add-f-ipt1 js_domain">&nbsp;.<?php echo Request::rootDomain(); ?>
          <div class="tips"><span style="line-height: 34px;color: #f00;margin-right: 10px;">*</span>二级域名字符数量为5~20之间，只能是字母(小写)、数字，不能以数字开头<?php if(!$info): ?>，还可输入 <span class="js_domainNum" style="color:red;">20</span> 字符<?php endif; ?></div>
        </td>
      </tr>
      <tr>
        <th valign="top"><label for="" class="add-f-label">公众号简介：</label></th>
        <td><textarea class="add-f-area js_intro" name="intro"><?php echo htmlentities($info['intro']); ?></textarea></td>
      </tr>
      <!--/*<tr>-->
        <!--<th valign="top"><label for="" class="add-f-label">公众号内容：</label></th>-->
        <!--<td><textarea class="js_content" name="content" id="js_editor" style="width:490px;">{$info.content</textarea></td>-->
      <!--</tr>-->
      <!--<tr>-->
        <!--<th><label for="" class="add-f-label">排序：</label></th>-->
        <!--<td><input name="view_order" style="width:102px;" value="<?php echo htmlentities($info['view_order']); ?>" type="text" class="add-f-ipt1"></td>-->
      <!--</tr>-->
      <!--<tr>-->
        <!--<th valign="top"><span class="add-f-label">公众号状态：</span></th>-->
        <!--<td>-->
          <!--<label for="normal" class="add-f-label"><input id="normal" type="radio" name="status" value="1" class="add-f-radio"<?php if($info['status'] == 1 || !isset($info['status'])): ?> checked="checked" <?php endif; ?>>正常</label>&nbsp;&nbsp;-->
          <!--<label for="delete" class="add-f-label"><input id="delete" type="radio" name="status" value="0" class="add-f-radio"<?php if($info['status'] == 0 && $info): ?> checked="checked" <?php endif; ?>>删除</label>-->
        <!--</td>-->
      <!--</tr>-->
      <!--*/}-->
      <tr><td></td><td class="noborder"><button type="submit" class="btn btn-success js_submit">&nbsp;&nbsp;&nbsp;确认&nbsp;&nbsp;&nbsp;</button>&nbsp;&nbsp;&nbsp;</td></tr>
    </table>
  </form>
</div>
<style>
a {
    color:#23a18b;
}
</style>
<script>
/**
 * 输入字符总数
 * @param string content
 * @return int
 */
function getDomainNum(content)
{
  var regx = "[\u4e00-\u9fa5]|[\uFE30-\uFFA0]";
  content = content.replace(new RegExp(regx, 'gm'), '11');
  
  return content.length;
}
function setNum(thisClass, maxNum) {
  var presentNum = getDomainNum($('.'+thisClass).val());
  var remainNum  = maxNum - presentNum;
  $('.'+thisClass+'Num').text(remainNum);
}

var infoId = "<?php echo htmlentities($info['id']); ?>" || 0;
$(function(){
  if (!infoId || infoId == 0) {
    // 初始化domain字数
    setNum('js_domain', 20);
    $('.js_domain').keyup(function(){
      setNum('js_domain', 20);
    });
  }
  
  $(".fancybox-button-wechat").fancybox({
    prevEffect  : 'none',
    nextEffect  : 'none',
    closeBtn    : false,
    helpers     : {
        title   : { type : 'over' },
        buttons : {}
    }
  });
  $(".fancybox-button-card").fancybox({
    prevEffect  : 'none',
    nextEffect  : 'none',
    closeBtn    : false,
    helpers     : {
        title   : { type : 'over' },
        buttons : {}
    }
  });
  
  // 提交验证
  $('.js_submit').click(function(e){
    e.preventDefault();
    if ($('.js_submit').attr('is_post') == 1) {
      showMsg('正在提交信息，请稍候 ...');
      return false;
    }
    
    var title    = $.trim($('.js_title').val());
    var wechatId = $.trim($('.js_wechatId').val());
    //var card     = $.trim($('.js_card').val());
    var domain   = $.trim($('.js_domain').val());
    //console.log(title);
    if (!title) {
      showMsg('公众号名称不能为空');
      return;
    }
    if (!wechatId) {
      showMsg('微信号不能为空');
      return;
    }
    /*
    if (!card) {
      showMsg('原始ID不能为空');
      return;
    }*/
    if (!infoId || infoId == 0) {
      var cover = $.trim($('.js_cover').val());
      if (!cover) {
        showMsg('封面不能为空');
        return;
      }
    }
    if (!domain) {
      showMsg('二级域名不能为空');
      return;
    }
    var pattern = /^[a-z][a-z0-9]*$/;　
    if (domain && !pattern.test(domain)) {
      showMsg('二级域名只能是字母(小写)、数字，不能以数字开头');
      return;
    }
    //alert(getDomainNum(domain));return;
    if (getDomainNum(domain) < 2 || getDomainNum(domain) > 20) {
      showMsg('二级域名字符数量为5~20之间');
      return;
    }

    postData = {
       'title'     : title,
       //'wechat_id' : wechatId,
       //'card'      : card,
       'domain'    : domain,
       'id'        : infoId
    };
    //console.log(postData);
    $('.js_submit').attr('is_post', 1);
    $.post(
        siteUrl+'/open_card/admin/check_info',
        postData,
        function(json){
         // $('.js_submit').attr('is_post', 0);
            console.log(json);
          if (json.info != 'ok') {
            showMsg(json.info);
            return;
          }

          $('.js_creatForm').submit();
        },'json'
    );
  });
  
  // 上传图片预览
  $(".js_upFile").each(function(i){
    $(this).change(function(e){
      handleFileSelect($(this));
    });
  });
});
</script>
<script type="text/javascript" src="./static/js/category.js"></script>
      </div>
      
    </div>
  </div>
      
      <div class="linkpop js_menuSetBox" style="display:none;">
          <div class="inner-linkpop">
      <span>
        <i class="arrowpop"></i>
        <b class="arrowpop2"></b>
      </span>
              <p class="options-list">
                  <!--<a class="js_menuIndexBtn" href="javascript:void(0);">关联到微官网</a>-->
                  <a class="js_menuLinkBtn" href="javascript:void(0);">跳转到网页</a>
                  <a class="js_menuTextBtn" href="javascript:void(0);">纯文字回复</a>
                  <a class="js_menuSingleBtn" href="javascript:void(0);">单条图文信息</a>
                  <a class="js_menuMultiBtn" href="javascript:void(0);">多条图文信息</a>
                  <a class="js_menuActivityBtn" href="javascript:void(0);">活动回复</a>
                  <!--{*<a class="js_menuImgBtn" href="javascript:void(0);">图片</a>-->
                  <!--<a class="js_menuVoiceBtn" href="javascript:void(0);">声音</a>-->
                  <!--<a class="js_menuCustomBtn" href="javascript:void(0);">智能回复</a>*}-->
              </p>
          </div>
      </div>

</div>
<span class="goTop go-top-box" style="display:none;"></span>
<script>
$(function(){
  // to-top
  goTopEx($(".goTop")[0]);
  // 点击其他地方隐藏弹层
  $(document).click(function(e){
    var s=e.target || e.srcElement;
    // 隐藏图文信息的编辑框
    if (!$(s).is('.js_showSetBoxBtn') && !$(s).is('.js_setBox') && $(s).parents(".js_setBox").size()<1) {
      $(".js_setBox").addClass('hidden');
    }
    
    // 隐藏个人设置弹框
    if (!$(s).is('.js_userSetBtn') && !$(s).is('.js_userSetBox') && $(s).parents(".js_userSetBox").size()<1) {
      $(".js_userSetBox").addClass('hidden');
    }
    
    // 隐藏个人设置弹框
    if (!$(s).is('.js_cardSetBtn') && !$(s).is('.js_cardSetBox') && $(s).parents(".js_cardSetBox").size()<1) {
      $(".js_cardSetBox").addClass('hidden');
    }
    
    // 隐藏菜单设置弹框
    if (!$(s).is('.js_setBtn') && !$(s).is('.js_menuSetBox') && $(s).parents(".js_menuSetBox").size()<1 && !$(s).is('.js_addNewContent') && $(s).parents(".js_addNewContent").size()<1) {
      $(".js_menuSetBox").hide();
    }
    
    // 隐藏表情弹框
    if (!$(s).is('#weiboface') && $(s).parents("#weiboface").size()<1 && !$(s).is('.js_faceBtn') && $(s).parents(".js_faceBtn").size()<1) {
      $("#weiboface").hide();
    }
    
    // 隐藏首页二维码
    if (!$(s).is('.js_mPreviewBtn') && $(s).parents(".js_mPreviewBtn").size()<1 && !$(s).is('.js_mPreviewBox') && $(s).parents(".js_mPreviewBox").size()<1) {
      $(".js_mPreviewBox").hide();
    }
    
    // 隐藏颜色框
    if (!$(s).is('.js_selectColorBtn') && $(s).parents(".js_selectColorBtn").size()<1 && !$(s).is('.js_selectColorBox') && $(s).parents(".js_selectColorBox").size()<1) {
      $(".js_selectColorBox").hide();
    }
    
    // 隐藏图标框
    if (!$(s).is('.js_selectIconBtn') && $(s).parents(".js_selectIconBtn").size()<1 && !$(s).is('.js_selectIconBox') && $(s).parents(".js_selectIconBox").size()<1) {
      $(".js_selectIconBox").hide();
    }
  });

    layui.use(['form', 'laypage'], function () {
        var form = layui.form
            , laypage = layui.laypage;

        laypage.render({ //分页
            elem: 'pages'
            , count: "<?php echo htmlentities($list['total']); ?>"
            , theme: '#FFB800'
            , limit: "<?php echo htmlentities($list['per_page']); ?>"
            , curr: "<?php echo htmlentities($list['current_page']); ?>"
            , jump:function(obj, first) {
                if (!first) {
                    //location.href = "?page="+obj.curr
                    var query = window.location.href;

                    var url = query.split("?")[0]+"?page="+obj.curr;
                    location.href = url;
                }
            }
        });
    });
});
</script>
</body>
</html>